<template>
  <div>
    <!-- 三级联动全局组件：三级联动已经注册为全局组件，因此不需要再次引入 -->
    <TypeNav></TypeNav>
    <!-- 其余的组件 --局部组件 -->
    <ListContainer></ListContainer>
    <Recommend></Recommend>
    <Rank></Rank>
    <Like></Like>
    <!-- Floor这个组件，自己在组件内部是没有发请求的，数据是父组件给的 -->
    <Floor v-for="(item, index) in floorList" :key="index" :list="item"></Floor>
    <!-- 在自定义标签中也可以使用v-for -->
    <Brand></Brand>
  </div>
</template>

<script>
//引入其余组件
import ListContainer from "@/views/Home/ListContainer";
import Recommend from "@/views/Home/Recommend";
import Rank from "@/views/Home/Rank";
import Like from "@/views/Home/Like";
import Floor from "@/views/Home/Floor";
import Brand from "@/views/Home/Brand";
import { mapState } from "vuex";
export default {
  name: "VueappSggIndex",
  components: {
    ListContainer,
    Recommend,
    Rank,
    Like,
    Floor,
    Brand,
  },
  data() {
    return {};
  },

  mounted() {
    //派发action，获取floor组件的数据
    this.$store.dispatch("getFloorList");
    //在组件挂载完毕派发action，如果有token才发派发这个函数
    this.$store.dispatch("getUserInfo");
  },
  computed: {
    //计算属性，在vuex中获取数据
    ...mapState({
      floorList: (state) => state.home.floorList,
    }),
  },

  methods: {},
};
</script>

<style lang="scss" scoped>
</style>